package fields;

import game.Player;

public class Fleet extends Ownable {

	
	private final int RENT_1, RENT_2, RENT_3, RENT_4;
	
	public Fleet(int number, String name, int price) { //Konstruktør	
	super(number, name, price);
	fieldValue=3;
	RENT_1 = 25;
	RENT_2 = 50;
	RENT_3 = 100;
	RENT_4 = 200;
	}
	
	public void landOnField(Player sp)
	{
		if (!isNotOwned() && sp!=owner)
		{
			sp.transfer(getRent(), owner);
		}
		else {
			if (sp.getChoice()==1) buy(sp);
		}
	}
	
	public int getRent()
	{
		int rent=0;
		switch (owner.getFleets()) {
		case 1: rent=RENT_1;
		break;
		case 2: rent=RENT_2;
		break;
		case 3: rent=RENT_3;
		break;
		case 4: rent=RENT_4;
		break;
		}
		return rent;
	}
	
	public void buy(Player p)
	{
		super.buy(p);
		p.addFleet(this);
	}
}